import request from '@/utils/request'
import { getStorage } from '@/utils/storage'

/**
 * 登录 - 请求登录接口
 * @returns Promise 对象
 */
export const loginAPI = (obj) => request({
  url: '/v1_0/authorizations',
  method: 'POST',
  data: { ...obj }
})

/**
   * 登录 - 刷新token接口
   * @returns Promise 对象
   */
// 用户 - 更新token
export const refreshTokenAPI = () => request({
  url: '/v1_0/authorizations',
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${getStorage('refresh_token')}`
  }
})
